package com.google.gwt.mobile.widgets.event;

import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.GwtEvent;
import com.google.gwt.user.client.Event;

/**
 * The Class AbstractTouchEvent.
 * 
 * @param <H> the handler type
 */
public abstract class AbstractTouchEvent<H extends EventHandler> extends GwtEvent<H> {
  private final Event _nativeEvent;

  private boolean _isStopPropagation = false;

  /**
   * Instantiates a new abstract touch event.
   * 
   * @param nativeEvent the native event
   */
  public AbstractTouchEvent(final Event nativeEvent) {
    _nativeEvent = nativeEvent;
  }

  /**
   * Gets the native event.
   * 
   * @return the native event
   */
  public Event getNativeEvent() {
    return _nativeEvent;
  }

  /**
   * Stop propagation.
   */
  public void stopPropagation() {
    _nativeEvent.stopPropagation();
    _isStopPropagation = true;
  }

  /**
   * Checks if is stop propagation.
   * 
   * @return true, if is stop propagation
   */
  public boolean isStopPropagation() {
    return _isStopPropagation;
  }
}
